<?php

require_once(DIR_LIB."VsCore".DIR_SEP."vsfile.php");

class VsImage {

	protected $_file = NULL;	// VsFile Object

	function VsImage($file) {
		$fileMime = finfo_file(finfo_open(FILEINFO_MIME), $file);
		$f = explode('/', $fileMime);
		if($f[0]=='image')
			$this->_file = &new VsFile($file);
	}
	//==============================================================================

	function copyPart($fromX, $fromY, $width, $height) {
		$img = imagecreatetruecolor($width, $height); 
		//$color = imagecolorallocate($img,$rgb['red'],$rgb['green'],$rgb['blue']); 
		//imagefilledrectangle($img,0,0,$w,$h,$color); 
		imagecopy($img, $this->_file->path(), 0, 0, $fromX, $fromY,$w,$h);

		return imagegif($img,'out.gif');
	}
	//===============================================================================


};

?>
